<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, BangPatterns #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# OPTIONS_GHC -fno-warn-unused-imports -fno-warn-orphans #-}</span><span class="hs-cpp">
#if __GLASGOW_HASKELL__ &gt;= 701
</span><span class="hs-pragma">{-# LANGUAGE Trustworthy #-}</span><span class="hs-cpp">
#endif
</span><span class="hs-comment">{- | Copyright   : (c) 2010 Jasper Van der Jeugt
                   (c) 2010 - 2011 Simon Meier
License     : BSD3-style (see LICENSE)
Maintainer  : Simon Meier &lt;iridcode@gmail.com&gt;
Portability : GHC

'Builder's are used to efficiently construct sequences of bytes from
  smaller parts.
Typically,
  such a construction is part of the implementation of an /encoding/, i.e.,
  a function for converting Haskell values to sequences of bytes.
Examples of encodings are the generation of the sequence of bytes
  representing a HTML document to be sent in a HTTP response by a
  web application or the serialization of a Haskell value using
  a fixed binary format.

For an /efficient implementation of an encoding/,
  it is important that (a) little time is spent on converting
  the Haskell values to the resulting sequence of bytes /and/
  (b) that the representation of the resulting sequence
  is such that it can be consumed efficiently.
'Builder's support (a) by providing an /O(1)/ concatentation operation
  and efficient implementations of basic encodings for 'Char's, 'Int's,
  and other standard Haskell values.
They support (b) by providing their result as a lazy 'L.ByteString',
  which is internally just a linked list of pointers to /chunks/
  of consecutive raw memory.
Lazy 'L.ByteString's can be efficiently consumed by functions that
  write them to a file or send them over a network socket.
Note that each chunk boundary incurs expensive extra work (e.g., a system call)
  that must be amortized over the work spent on consuming the chunk body.
'Builder's therefore take special care to ensure that the
  average chunk size is large enough.
The precise meaning of large enough is application dependent.
The current implementation is tuned
  for an average chunk size between 4kb and 32kb,
  which should suit most applications.

As a simple example of an encoding implementation,
  we show how to efficiently convert the following representation of mixed-data
  tables to an UTF-8 encoded Comma-Separated-Values (CSV) table.

&gt;data Cell = StringC String
&gt;          | IntC Int
&gt;          deriving( Eq, Ord, Show )
&gt;
&gt;type Row   = [Cell]
&gt;type Table = [Row]

We use the following imports and abbreviate 'mappend' to simplify reading.

@
import qualified &quot;Data.ByteString.Lazy&quot;               as L
import           &quot;Data.ByteString.Builder&quot;
import           Data.Monoid
import           Data.Foldable                        ('foldMap')
import           Data.List                            ('intersperse')

infixr 4 \&lt;\&gt;
(\&lt;\&gt;) :: 'Monoid' m =&gt; m -&gt; m -&gt; m
(\&lt;\&gt;) = 'mappend'
@

CSV is a character-based representation of tables. For maximal modularity,
we could first render @Table@s as 'String's and then encode this 'String'
using some Unicode character encoding. However, this sacrifices performance
due to the intermediate 'String' representation being built and thrown away
right afterwards. We get rid of this intermediate 'String' representation by
fixing the character encoding to UTF-8 and using 'Builder's to convert
@Table@s directly to UTF-8 encoded CSV tables represented as lazy
'L.ByteString's.

@
encodeUtf8CSV :: Table -&gt; L.ByteString
encodeUtf8CSV = 'toLazyByteString' . renderTable

renderTable :: Table -&gt; Builder
renderTable rs = 'mconcat' [renderRow r \&lt;\&gt; 'charUtf8' \'\\n\' | r &lt;- rs]

renderRow :: Row -&gt; Builder
renderRow []     = 'mempty'
renderRow (c:cs) =
    renderCell c \&lt;\&gt; mconcat [ charUtf8 \',\' \&lt;\&gt; renderCell c\' | c\' &lt;- cs ]

renderCell :: Cell -&gt; Builder
renderCell (StringC cs) = renderString cs
renderCell (IntC i)     = 'intDec' i

renderString :: String -&gt; Builder
renderString cs = charUtf8 \'\&quot;\' \&lt;\&gt; foldMap escape cs \&lt;\&gt; charUtf8 \'\&quot;\'
  where
    escape \'\\\\\' = charUtf8 \'\\\\\' \&lt;\&gt; charUtf8 \'\\\\\'
    escape \'\\\&quot;\' = charUtf8 \'\\\\\' \&lt;\&gt; charUtf8 \'\\\&quot;\'
    escape c    = charUtf8 c
@

Note that the ASCII encoding is a subset of the UTF-8 encoding,
  which is why we can use the optimized function 'intDec' to
  encode an 'Int' as a decimal number with UTF-8 encoded digits.
Using 'intDec' is more efficient than @'stringUtf8' . 'show'@,
  as it avoids constructing an intermediate 'String'.
Avoiding this intermediate data structure significantly improves
  performance because encoding @Cell@s is the core operation
  for rendering CSV-tables.
See &quot;Data.ByteString.Builder.Prim&quot; for further
  information on how to improve the performance of @renderString@.

We demonstrate our UTF-8 CSV encoding function on the following table.

@
strings :: [String]
strings =  [\&quot;hello\&quot;, \&quot;\\\&quot;1\\\&quot;\&quot;, \&quot;&amp;#955;-w&amp;#246;rld\&quot;]

table :: Table
table = [map StringC strings, map IntC [-3..3]]
@

The expression @encodeUtf8CSV table@ results in the following lazy
'L.ByteString'.

&gt;Chunk &quot;\&quot;hello\&quot;,\&quot;\\\&quot;1\\\&quot;\&quot;,\&quot;\206\187-w\195\182rld\&quot;\n-3,-2,-1,0,1,2,3\n&quot; Empty

We can clearly see that we are converting to a /binary/ format. The \'&amp;#955;\'
and \'&amp;#246;\' characters, which have a Unicode codepoint above 127, are
expanded to their corresponding UTF-8 multi-byte representation.

We use the @criterion@ library (&lt;http://hackage.haskell.org/package/criterion&gt;)
  to benchmark the efficiency of our encoding function on the following table.

&gt;import Criterion.Main     -- add this import to the ones above
&gt;
&gt;maxiTable :: Table
&gt;maxiTable = take 1000 $ cycle table
&gt;
&gt;main :: IO ()
&gt;main = defaultMain
&gt;  [ bench &quot;encodeUtf8CSV maxiTable (original)&quot; $
&gt;      whnf (L.length . encodeUtf8CSV) maxiTable
&gt;  ]

On a Core2 Duo 2.20GHz on a 32-bit Linux,
  the above code takes 1ms to generate the 22'500 bytes long lazy 'L.ByteString'.
Looking again at the definitions above,
  we see that we took care to avoid intermediate data structures,
  as otherwise we would sacrifice performance.
For example,
  the following (arguably simpler) definition of @renderRow@ is about 20% slower.

&gt;renderRow :: Row -&gt; Builder
&gt;renderRow  = mconcat . intersperse (charUtf8 ',') . map renderCell

Similarly, using /O(n)/ concatentations like '++' or the equivalent 'S.concat'
  operations on strict and lazy 'L.ByteString's should be avoided.
The following definition of @renderString@ is also about 20% slower.

&gt;renderString :: String -&gt; Builder
&gt;renderString cs = charUtf8 $ &quot;\&quot;&quot; ++ concatMap escape cs ++ &quot;\&quot;&quot;
&gt;  where
&gt;    escape '\\' = &quot;\\&quot;
&gt;    escape '\&quot;' = &quot;\\\&quot;&quot;
&gt;    escape c    = return c

Apart from removing intermediate data-structures,
  encodings can be optimized further by fine-tuning their execution
  parameters using the functions in &quot;Data.ByteString.Builder.Extra&quot; and
  their \&quot;inner loops\&quot; using the functions in
  &quot;Data.ByteString.Builder.Prim&quot;.
-}</span><span>
</span><span id="line-174"></span><span>
</span><span id="line-175"></span><span>
</span><span id="line-176"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">Data.ByteString.Builder</span><span>
</span><span id="line-177"></span><span>    </span><span class="hs-special">(</span><span>
</span><span id="line-178"></span><span>      </span><span class="annot"><span class="hs-comment">-- * The Builder type</span></span><span>
</span><span id="line-179"></span><span>      </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier">Builder</span></a></span><span>
</span><span id="line-180"></span><span>
</span><span id="line-181"></span><span>      </span><span class="annot"><span class="hs-comment">-- * Executing Builders</span></span><span>
</span><span id="line-182"></span><span>      </span><span class="hs-comment">-- | Internally, 'Builder's are buffer-filling functions. They are</span><span>
</span><span id="line-183"></span><span>      </span><span class="hs-comment">-- executed by a /driver/ that provides them with an actual buffer to</span><span>
</span><span id="line-184"></span><span>      </span><span class="hs-comment">-- fill. Once called with a buffer, a 'Builder' fills it and returns a</span><span>
</span><span id="line-185"></span><span>      </span><span class="hs-comment">-- signal to the driver telling it that it is either done, has filled the</span><span>
</span><span id="line-186"></span><span>      </span><span class="hs-comment">-- current buffer, or wants to directly insert a reference to a chunk of</span><span>
</span><span id="line-187"></span><span>      </span><span class="hs-comment">-- memory. In the last two cases, the 'Builder' also returns a</span><span>
</span><span id="line-188"></span><span>      </span><span class="hs-comment">-- continutation 'Builder' that the driver can call to fill the next</span><span>
</span><span id="line-189"></span><span>      </span><span class="hs-comment">-- buffer. Here, we provide the two drivers that satisfy almost all use</span><span>
</span><span id="line-190"></span><span>      </span><span class="hs-comment">-- cases. See &quot;Data.ByteString.Builder.Extra&quot;, for information</span><span>
</span><span id="line-191"></span><span>      </span><span class="hs-comment">-- about fine-tuning them.</span><span>
</span><span id="line-192"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#toLazyByteString"><span class="hs-identifier">toLazyByteString</span></a></span><span>
</span><span id="line-193"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#hPutBuilder"><span class="hs-identifier">hPutBuilder</span></a></span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span>      </span><span class="annot"><span class="hs-comment">-- * Creating Builders</span></span><span>
</span><span id="line-196"></span><span>
</span><span id="line-197"></span><span>      </span><span class="annot"><span class="hs-comment">-- ** Binary encodings</span></span><span>
</span><span id="line-198"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#byteString"><span class="hs-identifier">byteString</span></a></span><span>
</span><span id="line-199"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#lazyByteString"><span class="hs-identifier">lazyByteString</span></a></span><span>
</span><span id="line-200"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#shortByteString"><span class="hs-identifier">shortByteString</span></a></span><span>
</span><span id="line-201"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int8"><span class="hs-identifier">int8</span></a></span><span>
</span><span id="line-202"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word8"><span class="hs-identifier">word8</span></a></span><span>
</span><span id="line-203"></span><span>
</span><span id="line-204"></span><span>      </span><span class="annot"><span class="hs-comment">-- *** Big-endian</span></span><span>
</span><span id="line-205"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int16BE"><span class="hs-identifier">int16BE</span></a></span><span>
</span><span id="line-206"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int32BE"><span class="hs-identifier">int32BE</span></a></span><span>
</span><span id="line-207"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int64BE"><span class="hs-identifier">int64BE</span></a></span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word16BE"><span class="hs-identifier">word16BE</span></a></span><span>
</span><span id="line-210"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word32BE"><span class="hs-identifier">word32BE</span></a></span><span>
</span><span id="line-211"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word64BE"><span class="hs-identifier">word64BE</span></a></span><span>
</span><span id="line-212"></span><span>
</span><span id="line-213"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#floatBE"><span class="hs-identifier">floatBE</span></a></span><span>
</span><span id="line-214"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#doubleBE"><span class="hs-identifier">doubleBE</span></a></span><span>
</span><span id="line-215"></span><span>
</span><span id="line-216"></span><span>      </span><span class="annot"><span class="hs-comment">-- *** Little-endian</span></span><span>
</span><span id="line-217"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int16LE"><span class="hs-identifier">int16LE</span></a></span><span>
</span><span id="line-218"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int32LE"><span class="hs-identifier">int32LE</span></a></span><span>
</span><span id="line-219"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int64LE"><span class="hs-identifier">int64LE</span></a></span><span>
</span><span id="line-220"></span><span>
</span><span id="line-221"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word16LE"><span class="hs-identifier">word16LE</span></a></span><span>
</span><span id="line-222"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word32LE"><span class="hs-identifier">word32LE</span></a></span><span>
</span><span id="line-223"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word64LE"><span class="hs-identifier">word64LE</span></a></span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#floatLE"><span class="hs-identifier">floatLE</span></a></span><span>
</span><span id="line-226"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#doubleLE"><span class="hs-identifier">doubleLE</span></a></span><span>
</span><span id="line-227"></span><span>
</span><span id="line-228"></span><span>    </span><span class="annot"><span class="hs-comment">-- ** Character encodings</span></span><span>
</span><span id="line-229"></span><span>    </span><span class="annot"><span class="hs-comment">-- | Conversion from 'Char' and 'String' into 'Builder's in various encodings.</span></span><span>
</span><span id="line-230"></span><span>
</span><span id="line-231"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** ASCII (Char7)</span></span><span>
</span><span id="line-232"></span><span>    </span><span class="hs-comment">-- | The ASCII encoding is a 7-bit encoding. The /Char7/ encoding implemented here</span><span>
</span><span id="line-233"></span><span>    </span><span class="hs-comment">-- works by truncating the Unicode codepoint to 7-bits, prefixing it</span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-comment">-- with a leading 0, and encoding the resulting 8-bits as a single byte.</span><span>
</span><span id="line-235"></span><span>    </span><span class="hs-comment">-- For the codepoints 0-127 this corresponds the ASCII encoding.</span><span>
</span><span id="line-236"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#char7"><span class="hs-identifier">char7</span></a></span><span>
</span><span id="line-237"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#string7"><span class="hs-identifier">string7</span></a></span><span>
</span><span id="line-238"></span><span>
</span><span id="line-239"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** ISO/IEC 8859-1 (Char8)</span></span><span>
</span><span id="line-240"></span><span>    </span><span class="hs-comment">-- | The ISO/IEC 8859-1 encoding is an 8-bit encoding often known as Latin-1.</span><span>
</span><span id="line-241"></span><span>    </span><span class="hs-comment">-- The /Char8/ encoding implemented here works by truncating the Unicode codepoint</span><span>
</span><span id="line-242"></span><span>    </span><span class="hs-comment">-- to 8-bits and encoding them as a single byte. For the codepoints 0-255 this corresponds</span><span>
</span><span id="line-243"></span><span>    </span><span class="hs-comment">-- to the ISO/IEC 8859-1 encoding.</span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#char8"><span class="hs-identifier">char8</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#string8"><span class="hs-identifier">string8</span></a></span><span>
</span><span id="line-246"></span><span>
</span><span id="line-247"></span><span>    </span><span class="annot"><span class="hs-comment">-- *** UTF-8</span></span><span>
</span><span id="line-248"></span><span>    </span><span class="hs-comment">-- | The UTF-8 encoding can encode /all/ Unicode codepoints. We recommend</span><span>
</span><span id="line-249"></span><span>    </span><span class="hs-comment">-- using it always for encoding 'Char's and 'String's unless an application</span><span>
</span><span id="line-250"></span><span>    </span><span class="hs-comment">-- really requires another encoding.</span><span>
</span><span id="line-251"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#charUtf8"><span class="hs-identifier">charUtf8</span></a></span><span>
</span><span id="line-252"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#stringUtf8"><span class="hs-identifier">stringUtf8</span></a></span><span>
</span><span id="line-253"></span><span>
</span><span id="line-254"></span><span>    </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">module</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.ASCII.html"><span class="hs-identifier">Data.ByteString.Builder.ASCII</span></a></span><span>
</span><span id="line-255"></span><span>
</span><span id="line-256"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-257"></span><span>
</span><span id="line-258"></span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html"><span class="hs-identifier">Data.ByteString.Builder.Internal</span></a></span><span>
</span><span id="line-259"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Prim.html"><span class="hs-identifier">Data.ByteString.Builder.Prim</span></a></span><span>  </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">P</span></span><span>
</span><span id="line-260"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html"><span class="hs-identifier">Data.ByteString.Lazy.Internal</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">L</span></span><span>
</span><span id="line-261"></span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="Data.ByteString.Builder.ASCII.html"><span class="hs-identifier">Data.ByteString.Builder.ASCII</span></a></span><span>
</span><span id="line-262"></span><span>
</span><span id="line-263"></span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="../../base/src/Data.String.html#"><span class="hs-identifier">Data.String</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier">IsString</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-264"></span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier">Handle</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-265"></span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="../../base/src/Foreign.html#"><span class="hs-identifier">Foreign</span></a></span><span>
</span><span id="line-266"></span><span>
</span><span id="line-267"></span><span class="hs-comment">-- HADDOCK only imports</span><span>
</span><span id="line-268"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="Data.ByteString.html"><span class="hs-identifier">Data.ByteString</span></a></span><span>               </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">S</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="Data.ByteString.html#concat"><span class="hs-identifier">concat</span></a></span><span class="hs-special">)</span><span class="hs-cpp">
#if !(MIN_VERSION_base(4,8,0))
</span><span class="hs-keyword">import</span><span>           </span><span class="hs-identifier">Data.Monoid</span><span> </span><span class="hs-special">(</span><span class="hs-identifier">Monoid</span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-cpp">
#endif
</span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span>                      </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Foldable.html#foldMap"><span class="hs-identifier">foldMap</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-273"></span><span class="hs-keyword">import</span><span>           </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>                          </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.OldList.html#intersperse"><span class="hs-identifier">intersperse</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-274"></span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span class="hs-comment">-- | Execute a 'Builder' and return the generated chunks as a lazy 'L.ByteString'.</span><span>
</span><span id="line-277"></span><span class="hs-comment">-- The work is performed lazy, i.e., only when a chunk of the lazy 'L.ByteString'</span><span>
</span><span id="line-278"></span><span class="hs-comment">-- is forced.</span><span>
</span><span id="line-279"></span><span class="hs-pragma">{-# NOINLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#toLazyByteString"><span class="hs-pragma hs-type">toLazyByteString</span></a></span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="hs-comment">-- ensure code is shared</span><span>
</span><span id="line-280"></span><span class="annot"><a href="Data.ByteString.Builder.html#toLazyByteString"><span class="hs-identifier hs-type">toLazyByteString</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Lazy.Internal.html#ByteString"><span class="hs-identifier hs-type">L.ByteString</span></a></span><span>
</span><span id="line-281"></span><span id="toLazyByteString"><span class="annot"><span class="annottext">toLazyByteString :: Builder -&gt; ByteString
</span><a href="Data.ByteString.Builder.html#toLazyByteString"><span class="hs-identifier hs-var hs-var">toLazyByteString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">AllocationStrategy -&gt; ByteString -&gt; Builder -&gt; ByteString
</span><a href="Data.ByteString.Builder.Internal.html#toLazyByteStringWith"><span class="hs-identifier hs-var">toLazyByteStringWith</span></a></span><span>
</span><span id="line-282"></span><span>    </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; AllocationStrategy
</span><a href="Data.ByteString.Builder.Internal.html#safeStrategy"><span class="hs-identifier hs-var">safeStrategy</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#smallChunkSize"><span class="hs-identifier hs-var">L.smallChunkSize</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="Data.ByteString.Lazy.Internal.html#defaultChunkSize"><span class="hs-identifier hs-var">L.defaultChunkSize</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ByteString
</span><a href="Data.ByteString.Lazy.Internal.html#Empty"><span class="hs-identifier hs-var">L.Empty</span></a></span><span>
</span><span id="line-283"></span><span>
</span><span id="line-284"></span><span class="hs-comment">{- Not yet stable enough.
   See note on 'hPut' in Data.ByteString.Builder.Internal
-}</span><span>
</span><span id="line-287"></span><span>
</span><span id="line-288"></span><span class="hs-comment">-- | Output a 'Builder' to a 'Handle'.</span><span>
</span><span id="line-289"></span><span class="hs-comment">-- The 'Builder' is executed directly on the buffer of the 'Handle'. If the</span><span>
</span><span id="line-290"></span><span class="hs-comment">-- buffer is too small (or not present), then it is replaced with a large</span><span>
</span><span id="line-291"></span><span class="hs-comment">-- enough buffer.</span><span>
</span><span id="line-292"></span><span class="hs-comment">--</span><span>
</span><span id="line-293"></span><span class="hs-comment">-- It is recommended that the 'Handle' is set to binary and</span><span>
</span><span id="line-294"></span><span class="hs-comment">-- 'System.IO.BlockBuffering' mode. See 'System.IO.hSetBinaryMode' and</span><span>
</span><span id="line-295"></span><span class="hs-comment">-- 'System.IO.hSetBuffering'.</span><span>
</span><span id="line-296"></span><span class="hs-comment">--</span><span>
</span><span id="line-297"></span><span class="hs-comment">-- This function is more efficient than @hPut . 'toLazyByteString'@ because in</span><span>
</span><span id="line-298"></span><span class="hs-comment">-- many cases no buffer allocation has to be done. Moreover, the results of</span><span>
</span><span id="line-299"></span><span class="hs-comment">-- several executions of short 'Builder's are concatenated in the 'Handle's</span><span>
</span><span id="line-300"></span><span class="hs-comment">-- buffer, therefore avoiding unnecessary buffer flushes.</span><span>
</span><span id="line-301"></span><span class="annot"><a href="Data.ByteString.Builder.html#hPutBuilder"><span class="hs-identifier hs-type">hPutBuilder</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#IO"><span class="hs-identifier hs-type">IO</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-302"></span><span id="hPutBuilder"><span class="annot"><span class="annottext">hPutBuilder :: Handle -&gt; Builder -&gt; IO ()
</span><a href="Data.ByteString.Builder.html#hPutBuilder"><span class="hs-identifier hs-var hs-var">hPutBuilder</span></a></span></span><span> </span><span id="local-6989586621679078992"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679078992"><span class="hs-identifier hs-var">h</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; Put () -&gt; IO ()
forall a. Handle -&gt; Put a -&gt; IO a
</span><a href="Data.ByteString.Builder.Internal.html#hPut"><span class="hs-identifier hs-var">hPut</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621679078992"><span class="hs-identifier hs-var">h</span></a></span><span> </span><span class="annot"><span class="annottext">(Put () -&gt; IO ()) -&gt; (Builder -&gt; Put ()) -&gt; Builder -&gt; IO ()
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Builder -&gt; Put ()
</span><a href="Data.ByteString.Builder.Internal.html#putBuilder"><span class="hs-identifier hs-var">putBuilder</span></a></span><span>
</span><span id="line-303"></span><span>
</span><span id="line-304"></span><span>
</span><span id="line-305"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-306"></span><span class="hs-comment">-- Binary encodings</span><span>
</span><span id="line-307"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-308"></span><span>
</span><span id="line-309"></span><span class="hs-comment">-- | Encode a single signed byte as-is.</span><span>
</span><span id="line-310"></span><span class="hs-comment">--</span><span>
</span><span id="line-311"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int8"><span class="hs-pragma hs-type">int8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-312"></span><span class="annot"><a href="Data.ByteString.Builder.html#int8"><span class="hs-identifier hs-type">int8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int8"><span class="hs-identifier hs-type">Int8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-313"></span><span id="int8"><span class="annot"><span class="annottext">int8 :: Int8 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int8"><span class="hs-identifier hs-var hs-var">int8</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int8 -&gt; Int8 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int8
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int8"><span class="hs-identifier hs-var">P.int8</span></a></span><span>
</span><span id="line-314"></span><span>
</span><span id="line-315"></span><span class="hs-comment">-- | Encode a single unsigned byte as-is.</span><span>
</span><span id="line-316"></span><span class="hs-comment">--</span><span>
</span><span id="line-317"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word8"><span class="hs-pragma hs-type">word8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-318"></span><span class="annot"><a href="Data.ByteString.Builder.html#word8"><span class="hs-identifier hs-type">word8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word8"><span class="hs-identifier hs-type">Word8</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-319"></span><span id="word8"><span class="annot"><span class="annottext">word8 :: Word8 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word8"><span class="hs-identifier hs-var hs-var">word8</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word8 -&gt; Word8 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word8
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word8"><span class="hs-identifier hs-var">P.word8</span></a></span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span>
</span><span id="line-322"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-323"></span><span class="hs-comment">-- Binary little-endian encodings</span><span>
</span><span id="line-324"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-325"></span><span>
</span><span id="line-326"></span><span class="hs-comment">-- | Encode an 'Int16' in little endian format.</span><span>
</span><span id="line-327"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int16LE"><span class="hs-pragma hs-type">int16LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-328"></span><span class="annot"><a href="Data.ByteString.Builder.html#int16LE"><span class="hs-identifier hs-type">int16LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-identifier hs-type">Int16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-329"></span><span id="int16LE"><span class="annot"><span class="annottext">int16LE :: Int16 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int16LE"><span class="hs-identifier hs-var hs-var">int16LE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int16 -&gt; Int16 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int16
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int16LE"><span class="hs-identifier hs-var">P.int16LE</span></a></span><span>
</span><span id="line-330"></span><span>
</span><span id="line-331"></span><span class="hs-comment">-- | Encode an 'Int32' in little endian format.</span><span>
</span><span id="line-332"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int32LE"><span class="hs-pragma hs-type">int32LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-333"></span><span class="annot"><a href="Data.ByteString.Builder.html#int32LE"><span class="hs-identifier hs-type">int32LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-334"></span><span id="int32LE"><span class="annot"><span class="annottext">int32LE :: Int32 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int32LE"><span class="hs-identifier hs-var hs-var">int32LE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int32 -&gt; Int32 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int32
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int32LE"><span class="hs-identifier hs-var">P.int32LE</span></a></span><span>
</span><span id="line-335"></span><span>
</span><span id="line-336"></span><span class="hs-comment">-- | Encode an 'Int64' in little endian format.</span><span>
</span><span id="line-337"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int64LE"><span class="hs-pragma hs-type">int64LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-338"></span><span class="annot"><a href="Data.ByteString.Builder.html#int64LE"><span class="hs-identifier hs-type">int64LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-339"></span><span id="int64LE"><span class="annot"><span class="annottext">int64LE :: Int64 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int64LE"><span class="hs-identifier hs-var hs-var">int64LE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int64 -&gt; Int64 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int64
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int64LE"><span class="hs-identifier hs-var">P.int64LE</span></a></span><span>
</span><span id="line-340"></span><span>
</span><span id="line-341"></span><span class="hs-comment">-- | Encode a 'Word16' in little endian format.</span><span>
</span><span id="line-342"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word16LE"><span class="hs-pragma hs-type">word16LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-343"></span><span class="annot"><a href="Data.ByteString.Builder.html#word16LE"><span class="hs-identifier hs-type">word16LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-344"></span><span id="word16LE"><span class="annot"><span class="annottext">word16LE :: Word16 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word16LE"><span class="hs-identifier hs-var hs-var">word16LE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word16 -&gt; Word16 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word16
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word16LE"><span class="hs-identifier hs-var">P.word16LE</span></a></span><span>
</span><span id="line-345"></span><span>
</span><span id="line-346"></span><span class="hs-comment">-- | Encode a 'Word32' in little endian format.</span><span>
</span><span id="line-347"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word32LE"><span class="hs-pragma hs-type">word32LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-348"></span><span class="annot"><a href="Data.ByteString.Builder.html#word32LE"><span class="hs-identifier hs-type">word32LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-349"></span><span id="word32LE"><span class="annot"><span class="annottext">word32LE :: Word32 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word32LE"><span class="hs-identifier hs-var hs-var">word32LE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word32 -&gt; Word32 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word32
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word32LE"><span class="hs-identifier hs-var">P.word32LE</span></a></span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span class="hs-comment">-- | Encode a 'Word64' in little endian format.</span><span>
</span><span id="line-352"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word64LE"><span class="hs-pragma hs-type">word64LE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-353"></span><span class="annot"><a href="Data.ByteString.Builder.html#word64LE"><span class="hs-identifier hs-type">word64LE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier hs-type">Word64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-354"></span><span id="word64LE"><span class="annot"><span class="annottext">word64LE :: Word64 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word64LE"><span class="hs-identifier hs-var hs-var">word64LE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word64 -&gt; Word64 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word64
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word64LE"><span class="hs-identifier hs-var">P.word64LE</span></a></span><span>
</span><span id="line-355"></span><span>
</span><span id="line-356"></span><span class="hs-comment">-- | Encode a 'Float' in little endian format.</span><span>
</span><span id="line-357"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#floatLE"><span class="hs-pragma hs-type">floatLE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-358"></span><span class="annot"><a href="Data.ByteString.Builder.html#floatLE"><span class="hs-identifier hs-type">floatLE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-359"></span><span id="floatLE"><span class="annot"><span class="annottext">floatLE :: Float -&gt; Builder
</span><a href="Data.ByteString.Builder.html#floatLE"><span class="hs-identifier hs-var hs-var">floatLE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Float -&gt; Float -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Float
</span><a href="Data.ByteString.Builder.Prim.Binary.html#floatLE"><span class="hs-identifier hs-var">P.floatLE</span></a></span><span>
</span><span id="line-360"></span><span>
</span><span id="line-361"></span><span class="hs-comment">-- | Encode a 'Double' in little endian format.</span><span>
</span><span id="line-362"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#doubleLE"><span class="hs-pragma hs-type">doubleLE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-363"></span><span class="annot"><a href="Data.ByteString.Builder.html#doubleLE"><span class="hs-identifier hs-type">doubleLE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-364"></span><span id="doubleLE"><span class="annot"><span class="annottext">doubleLE :: Double -&gt; Builder
</span><a href="Data.ByteString.Builder.html#doubleLE"><span class="hs-identifier hs-var hs-var">doubleLE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Double -&gt; Double -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Double
</span><a href="Data.ByteString.Builder.Prim.Binary.html#doubleLE"><span class="hs-identifier hs-var">P.doubleLE</span></a></span><span>
</span><span id="line-365"></span><span>
</span><span id="line-366"></span><span>
</span><span id="line-367"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-368"></span><span class="hs-comment">-- Binary big-endian encodings</span><span>
</span><span id="line-369"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-370"></span><span>
</span><span id="line-371"></span><span class="hs-comment">-- | Encode an 'Int16' in big endian format.</span><span>
</span><span id="line-372"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int16BE"><span class="hs-pragma hs-type">int16BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-373"></span><span class="annot"><a href="Data.ByteString.Builder.html#int16BE"><span class="hs-identifier hs-type">int16BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int16"><span class="hs-identifier hs-type">Int16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-374"></span><span id="int16BE"><span class="annot"><span class="annottext">int16BE :: Int16 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int16BE"><span class="hs-identifier hs-var hs-var">int16BE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int16 -&gt; Int16 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int16
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int16BE"><span class="hs-identifier hs-var">P.int16BE</span></a></span><span>
</span><span id="line-375"></span><span>
</span><span id="line-376"></span><span class="hs-comment">-- | Encode an 'Int32' in big endian format.</span><span>
</span><span id="line-377"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int32BE"><span class="hs-pragma hs-type">int32BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-378"></span><span class="annot"><a href="Data.ByteString.Builder.html#int32BE"><span class="hs-identifier hs-type">int32BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int32"><span class="hs-identifier hs-type">Int32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-379"></span><span id="int32BE"><span class="annot"><span class="annottext">int32BE :: Int32 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int32BE"><span class="hs-identifier hs-var hs-var">int32BE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int32 -&gt; Int32 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int32
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int32BE"><span class="hs-identifier hs-var">P.int32BE</span></a></span><span>
</span><span id="line-380"></span><span>
</span><span id="line-381"></span><span class="hs-comment">-- | Encode an 'Int64' in big endian format.</span><span>
</span><span id="line-382"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#int64BE"><span class="hs-pragma hs-type">int64BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-383"></span><span class="annot"><a href="Data.ByteString.Builder.html#int64BE"><span class="hs-identifier hs-type">int64BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Int.html#Int64"><span class="hs-identifier hs-type">Int64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-384"></span><span id="int64BE"><span class="annot"><span class="annottext">int64BE :: Int64 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#int64BE"><span class="hs-identifier hs-var hs-var">int64BE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Int64 -&gt; Int64 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Int64
</span><a href="Data.ByteString.Builder.Prim.Binary.html#int64BE"><span class="hs-identifier hs-var">P.int64BE</span></a></span><span>
</span><span id="line-385"></span><span>
</span><span id="line-386"></span><span class="hs-comment">-- | Encode a 'Word16' in big endian format.</span><span>
</span><span id="line-387"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word16BE"><span class="hs-pragma hs-type">word16BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-388"></span><span class="annot"><a href="Data.ByteString.Builder.html#word16BE"><span class="hs-identifier hs-type">word16BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word16"><span class="hs-identifier hs-type">Word16</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-389"></span><span id="word16BE"><span class="annot"><span class="annottext">word16BE :: Word16 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word16BE"><span class="hs-identifier hs-var hs-var">word16BE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word16 -&gt; Word16 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word16
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word16BE"><span class="hs-identifier hs-var">P.word16BE</span></a></span><span>
</span><span id="line-390"></span><span>
</span><span id="line-391"></span><span class="hs-comment">-- | Encode a 'Word32' in big endian format.</span><span>
</span><span id="line-392"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word32BE"><span class="hs-pragma hs-type">word32BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-393"></span><span class="annot"><a href="Data.ByteString.Builder.html#word32BE"><span class="hs-identifier hs-type">word32BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word32"><span class="hs-identifier hs-type">Word32</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-394"></span><span id="word32BE"><span class="annot"><span class="annottext">word32BE :: Word32 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word32BE"><span class="hs-identifier hs-var hs-var">word32BE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word32 -&gt; Word32 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word32
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word32BE"><span class="hs-identifier hs-var">P.word32BE</span></a></span><span>
</span><span id="line-395"></span><span>
</span><span id="line-396"></span><span class="hs-comment">-- | Encode a 'Word64' in big endian format.</span><span>
</span><span id="line-397"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#word64BE"><span class="hs-pragma hs-type">word64BE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-398"></span><span class="annot"><a href="Data.ByteString.Builder.html#word64BE"><span class="hs-identifier hs-type">word64BE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Word.html#Word64"><span class="hs-identifier hs-type">Word64</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-399"></span><span id="word64BE"><span class="annot"><span class="annottext">word64BE :: Word64 -&gt; Builder
</span><a href="Data.ByteString.Builder.html#word64BE"><span class="hs-identifier hs-var hs-var">word64BE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Word64 -&gt; Word64 -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Word64
</span><a href="Data.ByteString.Builder.Prim.Binary.html#word64BE"><span class="hs-identifier hs-var">P.word64BE</span></a></span><span>
</span><span id="line-400"></span><span>
</span><span id="line-401"></span><span class="hs-comment">-- | Encode a 'Float' in big endian format.</span><span>
</span><span id="line-402"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#floatBE"><span class="hs-pragma hs-type">floatBE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-403"></span><span class="annot"><a href="Data.ByteString.Builder.html#floatBE"><span class="hs-identifier hs-type">floatBE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Float"><span class="hs-identifier hs-type">Float</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-404"></span><span id="floatBE"><span class="annot"><span class="annottext">floatBE :: Float -&gt; Builder
</span><a href="Data.ByteString.Builder.html#floatBE"><span class="hs-identifier hs-var hs-var">floatBE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Float -&gt; Float -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Float
</span><a href="Data.ByteString.Builder.Prim.Binary.html#floatBE"><span class="hs-identifier hs-var">P.floatBE</span></a></span><span>
</span><span id="line-405"></span><span>
</span><span id="line-406"></span><span class="hs-comment">-- | Encode a 'Double' in big endian format.</span><span>
</span><span id="line-407"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#doubleBE"><span class="hs-pragma hs-type">doubleBE</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-408"></span><span class="annot"><a href="Data.ByteString.Builder.html#doubleBE"><span class="hs-identifier hs-type">doubleBE</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Double"><span class="hs-identifier hs-type">Double</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-409"></span><span id="doubleBE"><span class="annot"><span class="annottext">doubleBE :: Double -&gt; Builder
</span><a href="Data.ByteString.Builder.html#doubleBE"><span class="hs-identifier hs-var hs-var">doubleBE</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Double -&gt; Double -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Double
</span><a href="Data.ByteString.Builder.Prim.Binary.html#doubleBE"><span class="hs-identifier hs-var">P.doubleBE</span></a></span><span>
</span><span id="line-410"></span><span>
</span><span id="line-411"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-412"></span><span class="hs-comment">-- ASCII encoding</span><span>
</span><span id="line-413"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-414"></span><span>
</span><span id="line-415"></span><span class="hs-comment">-- | Char7 encode a 'Char'.</span><span>
</span><span id="line-416"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#char7"><span class="hs-pragma hs-type">char7</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-417"></span><span class="annot"><a href="Data.ByteString.Builder.html#char7"><span class="hs-identifier hs-type">char7</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-418"></span><span id="char7"><span class="annot"><span class="annottext">char7 :: Char -&gt; Builder
</span><a href="Data.ByteString.Builder.html#char7"><span class="hs-identifier hs-var hs-var">char7</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Char -&gt; Char -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Char
</span><a href="Data.ByteString.Builder.Prim.ASCII.html#char7"><span class="hs-identifier hs-var">P.char7</span></a></span><span>
</span><span id="line-419"></span><span>
</span><span id="line-420"></span><span class="hs-comment">-- | Char7 encode a 'String'.</span><span>
</span><span id="line-421"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#string7"><span class="hs-pragma hs-type">string7</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-422"></span><span class="annot"><a href="Data.ByteString.Builder.html#string7"><span class="hs-identifier hs-type">string7</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-423"></span><span id="string7"><span class="annot"><span class="annottext">string7 :: String -&gt; Builder
</span><a href="Data.ByteString.Builder.html#string7"><span class="hs-identifier hs-var hs-var">string7</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Char -&gt; String -&gt; Builder
forall a. FixedPrim a -&gt; [a] -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primMapListFixed"><span class="hs-identifier hs-var">P.primMapListFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Char
</span><a href="Data.ByteString.Builder.Prim.ASCII.html#char7"><span class="hs-identifier hs-var">P.char7</span></a></span><span>
</span><span id="line-424"></span><span>
</span><span id="line-425"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- ISO/IEC 8859-1 encoding</span><span>
</span><span id="line-427"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-428"></span><span>
</span><span id="line-429"></span><span class="hs-comment">-- | Char8 encode a 'Char'.</span><span>
</span><span id="line-430"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#char8"><span class="hs-pragma hs-type">char8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-431"></span><span class="annot"><a href="Data.ByteString.Builder.html#char8"><span class="hs-identifier hs-type">char8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-432"></span><span id="char8"><span class="annot"><span class="annottext">char8 :: Char -&gt; Builder
</span><a href="Data.ByteString.Builder.html#char8"><span class="hs-identifier hs-var hs-var">char8</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Char -&gt; Char -&gt; Builder
forall a. FixedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primFixed"><span class="hs-identifier hs-var">P.primFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Char
</span><a href="Data.ByteString.Builder.Prim.html#char8"><span class="hs-identifier hs-var">P.char8</span></a></span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span class="hs-comment">-- | Char8 encode a 'String'.</span><span>
</span><span id="line-435"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#string8"><span class="hs-pragma hs-type">string8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-436"></span><span class="annot"><a href="Data.ByteString.Builder.html#string8"><span class="hs-identifier hs-type">string8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-437"></span><span id="string8"><span class="annot"><span class="annottext">string8 :: String -&gt; Builder
</span><a href="Data.ByteString.Builder.html#string8"><span class="hs-identifier hs-var hs-var">string8</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FixedPrim Char -&gt; String -&gt; Builder
forall a. FixedPrim a -&gt; [a] -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primMapListFixed"><span class="hs-identifier hs-var">P.primMapListFixed</span></a></span><span> </span><span class="annot"><span class="annottext">FixedPrim Char
</span><a href="Data.ByteString.Builder.Prim.html#char8"><span class="hs-identifier hs-var">P.char8</span></a></span><span>
</span><span id="line-438"></span><span>
</span><span id="line-439"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-440"></span><span class="hs-comment">-- UTF-8 encoding</span><span>
</span><span id="line-441"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-comment">-- | UTF-8 encode a 'Char'.</span><span>
</span><span id="line-444"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#charUtf8"><span class="hs-pragma hs-type">charUtf8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-445"></span><span class="annot"><a href="Data.ByteString.Builder.html#charUtf8"><span class="hs-identifier hs-type">charUtf8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../ghc-prim/src/GHC.Types.html#Char"><span class="hs-identifier hs-type">Char</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-446"></span><span id="charUtf8"><span class="annot"><span class="annottext">charUtf8 :: Char -&gt; Builder
</span><a href="Data.ByteString.Builder.html#charUtf8"><span class="hs-identifier hs-var hs-var">charUtf8</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BoundedPrim Char -&gt; Char -&gt; Builder
forall a. BoundedPrim a -&gt; a -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primBounded"><span class="hs-identifier hs-var">P.primBounded</span></a></span><span> </span><span class="annot"><span class="annottext">BoundedPrim Char
</span><a href="Data.ByteString.Builder.Prim.html#charUtf8"><span class="hs-identifier hs-var">P.charUtf8</span></a></span><span>
</span><span id="line-447"></span><span>
</span><span id="line-448"></span><span class="hs-comment">-- | UTF-8 encode a 'String'.</span><span>
</span><span id="line-449"></span><span class="hs-pragma">{-# INLINE</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.html#stringUtf8"><span class="hs-pragma hs-type">stringUtf8</span></a></span><span> </span><span class="hs-pragma">#-}</span><span>
</span><span id="line-450"></span><span class="annot"><a href="Data.ByteString.Builder.html#stringUtf8"><span class="hs-identifier hs-type">stringUtf8</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span>
</span><span id="line-451"></span><span id="stringUtf8"><span class="annot"><span class="annottext">stringUtf8 :: String -&gt; Builder
</span><a href="Data.ByteString.Builder.html#stringUtf8"><span class="hs-identifier hs-var hs-var">stringUtf8</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">BoundedPrim Char -&gt; String -&gt; Builder
forall a. BoundedPrim a -&gt; [a] -&gt; Builder
</span><a href="Data.ByteString.Builder.Prim.html#primMapListBounded"><span class="hs-identifier hs-var">P.primMapListBounded</span></a></span><span> </span><span class="annot"><span class="annottext">BoundedPrim Char
</span><a href="Data.ByteString.Builder.Prim.html#charUtf8"><span class="hs-identifier hs-var">P.charUtf8</span></a></span><span>
</span><span id="line-452"></span><span>
</span><span id="line-453"></span><span class="hs-keyword">instance</span><span> </span><span class="annot"><a href="../../base/src/Data.String.html#IsString"><span class="hs-identifier hs-type">IsString</span></a></span><span> </span><span class="annot"><a href="Data.ByteString.Builder.Internal.html#Builder"><span class="hs-identifier hs-type">Builder</span></a></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-454"></span><span>    </span><span id="local-6989586621679078960"><span class="annot"><span class="annottext">fromString :: String -&gt; Builder
</span><a href="../../base/src/Data.String.html#fromString"><span class="hs-identifier hs-var hs-var hs-var hs-var">fromString</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; Builder
</span><a href="Data.ByteString.Builder.html#stringUtf8"><span class="hs-identifier hs-var">stringUtf8</span></a></span><span>
</span><span id="line-455"></span></pre></body></html>